Skip to content

fix(packages-fetch): report download progress in staged_install - #1293

Merged
zackees merged 1 commit into
mainfrom
fix/1286-download-progress
Aug 10, 2026
Merged

fix(packages-fetch): report download progress in staged_install#1293
zackees merged 1 commit into
mainfrom
fix/1286-download-progress

Conversation

@zackees

@zackees zackees commented Aug 10, 2026

Copy link
Copy Markdown
Member

Problem

Issue #1286: Toolchain downloads (e.g. arm-gcc) show the same static "downloading arm-gcc 15.2.Rel1" message repeatedly with no sense of progress. During large downloads, users see the same line ~17 times with no percentage, byte count, or ETA.

Fix

PackageBase::staged_install() was using downloader::download_file() (simple buffered download, no progress). Switched to downloader::download_file_with_progress(), which streams the response and fires a callback every 15 seconds or every 10% progress.

The callback publishes progress via install_status::publish_install_status(), which the daemon status stream surfaces to the CLI. The DownloadProgress::format_message() produces output like "arm-gcc-15.2.Rel1.tar.gz: 50/150 MB (33%)" instead of the previous static message.

Testing

  • soldr cargo check -p fbuild-packages-fetch — compiles clean
  • soldr cargo clippy -p fbuild-packages-fetch -- -D warnings — no new warnings
  • soldr cargo test -p fbuild-packages-fetch — all 130 tests pass

Closes #1286

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Enhancements
    • Package downloads now display ongoing progress updates instead of a single status message.
    • Download failures continue to be reported normally.

Switch from download_file() to download_file_with_progress() so
toolchain/framework downloads emit periodic progress updates
(e.g. "arm-gcc: 50/150 MB (33%)") instead of repeating the same
static "downloading" message.

The DownloadProgress::format_message() already produces
human-readable output with bytes and percentage; the progress
callback publishes it via install_status so the daemon status
stream (and CLI) show real download progress.

Closes #1286

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

PackageBase::staged_install now uses the progress-reporting downloader. It forwards formatted downloader messages through install_status and continues to propagate download errors.

Changes

Package download progress

Layer / File(s) Summary
Progress reporting in staged installation
crates/fbuild-packages-fetch/src/lib.rs
staged_install replaces the basic download call and fixed status event with progress-aware downloading. The callback publishes formatted progress messages with package identity data. Download errors still propagate.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: reporting download progress in staged_install.
Linked Issues check ✅ Passed The changes satisfy issue #1286 by publishing meaningful download progress during toolchain downloads.
Out of Scope Changes check ✅ Passed The changes are limited to progress-aware downloads and status reporting required by issue #1286.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1286-download-progress

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/fbuild-packages-fetch/src/lib.rs`:
- Around line 374-380: Update the progress callback around
download_file_with_progress_timed so forwarded progress remains monotonic across
retries. Track the highest published progress and either adjust retry progress
to preserve it or suppress values lower than the previous value before calling
install_status::publish_install_status; retain normal progress updates when they
are not regressive.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 811cad71-a215-463d-9746-b90fa2f3872f

📥 Commits

Reviewing files that changed from the base of the PR and between 518d2b8 and 3f75cd0.

📒 Files selected for processing (1)
  • crates/fbuild-packages-fetch/src/lib.rs

Comment on lines +374 to +380
&mut |progress: &downloader::DownloadProgress| {
install_status::publish_install_status(install_status::status(
&name,
Some(&version),
InstallPhase::Downloading,
InstallRole::Installer,
progress.format_message(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep forwarded download progress monotonic across retries.

download_file_with_progress_timed resets downloaded and last_pct for each retry. If one attempt publishes 50/150 MB (33%) and then retries, this callback can publish a lower value such as 10/150 MB (6%). The daemon and CLI will show progress moving backward. Publish retry-aware progress or suppress lower values before forwarding them to install_status.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/fbuild-packages-fetch/src/lib.rs` around lines 374 - 380, Update the
progress callback around download_file_with_progress_timed so forwarded progress
remains monotonic across retries. Track the highest published progress and
either adjust retry progress to preserve it or suppress values lower than the
previous value before calling install_status::publish_install_status; retain
normal progress updates when they are not regressive.

@zackees
zackees merged commit 9276692 into main Aug 10, 2026
8 of 93 checks passed
zackees added a commit that referenced this pull request Aug 10, 2026
…t objects

PR #1293 introduced the download_file_with_progress() API with
`&mut dyn FnMut(&DownloadProgress)` callbacks, but the async runtime
requires these closures to be Send because they cross .await points.
Add `+ Send` to all three trait-object sites.

Co-Authored-By: Claude <noreply@anthropic.com>
zackees added a commit that referenced this pull request Aug 10, 2026
…llbacks (#1295)

Follow-up to #1293. Adds + Send to dyn FnMut callback parameters in download_file_with_progress so the async block in staged_install satisfies the Send bound on MSRV 1.94.1.

Closes #1286.

Co-Authored-By: Claude <noreply@anthropic.com>
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

bash compile nrfmicro_nrf52840 produces boring output

1 participant